package SoftwareEngineering01.WordFrequence.Step1;

import SoftwareEngineering01.WordFrequence.Step0.Counting;
import SoftwareEngineering01.WordFrequence.readFile.Article;

import java.io.File;
import java.io.IOException;

public class Search {
    public static void SearchFor(String dir) throws IOException{
        File file = new File(dir);
        if(!file.exists()){
            System.out.println("无法找到该文档");
            return;
        }
        File[] files = file.listFiles();
        if(files == null){
            System.out.println("该文件夹为空");
            return;
        }
        for(File file1 : files){
            if(file1.isDirectory()){
                SearchFor(file1.getAbsolutePath());
            }else{
                Counting_01.counting_01(Article.article(file1));
            }
        }
    }
}
